home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
t3_1
/
xlib.lha
/
xlib
/
wss-ext.t
< prev
next >
Wrap
Text File
|
1990-06-06
|
2KB
|
56 lines
;;; RHH, September, 1989.
;;; Extensions/replacements for standard Xlib interfaces, should go in xwss.sc.
(herald wss-ext)
;;; Write-around for XrmGetResource in the standard Scheme->C X library:
(DEFINE-FOREIGN XRMGETRESOURCE*
("XrmGetResource" (IN REP/C-POINTER)
(IN REP/string)
(IN REP/string)
(IN REP/EXTEND)
(IN REP/EXTEND))
REP/INTEGER)
(DEFINE
(XRMGETRESOURCE DB NAME_STR CLASS_STR)
(LET*
((DB (CHK-XRMdatabase DB))
(NAME_STR
(IF
(STRING? name_str)
(string->asciz! name_str)
(ERROR "Argument is incorrect type: ~s" name_str)))
(CLASS_STR
(IF
(STRING? class_str)
(string->asciz! class_str)
(ERROR "Argument is incorrect type: ~s" class_str)))
(PTYPE_STR (MAKE-bytev 4))
(PVALUE (MAKE-xrmvalue))
(RETURN-VALUE (XRMGETRESOURCE* DB NAME_STR CLASS_STR PTYPE_STR
(chk-xrmvalueptr PVALUE))))
(return
RETURN-VALUE
(mref-pointer PTYPE_STR 0)
pvalue)))
(define (YrmGetResource db name_str class_str)
(receive (return-code type-chara rmvalue) (XrmGetResource db name_str class_str)
(if (zero? return-code)
'()
(let ((type-string (asciz->string type-chara)))
(if (equal? type-string "String")
(asciz->string (chk-charap (xrmvalue-addr rmvalue)))
(error "Unimplemented resource type in YrmGetResource"
type-string))))))
(define (YrmMergeDatabases new into)
(let ((into-p (make-bytev 4)))
(set-mref-pointer! into-p 0 (chk-xrmdatabase into))
(XrmMergeDatabases new (type/value->pointer 'xrmdatabasep into-p))
(type/value->pointer 'xrmdatabase (mref-pointer into-p 0))))